home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2000 February / Macworld (2000-02).dmg / Games World / Hot demos! / Starbound II / AI agents / Gypsum 1.00 / Gypsum 1.00.rsrc / ss$t_134 < prev    next >
Text File  |  1999-10-30  |  981b  |  52 lines

  1. situation orbital_deployment
  2. vars
  3.    send : integer;
  4.    target : integer;
  5.    success : boolean;
  6.  
  7. function max_send_down() : integer;
  8. vars
  9.    total : integer;
  10.    i : integer;
  11.    
  12. begin
  13.    total := 0;
  14.    i := 1;              // troop type 0 is colonist (which can't be sent down)
  15.    while (i < 8) do
  16.       begin
  17.          total := total + Num_unit_type_fleet(i);
  18.          i := i + 1;
  19.       end;
  20.    if (total > 8) then
  21.       total := 8;
  22.    return total;
  23. end;
  24.  
  25. function deploy_random_squad(number : integer) : none;
  26. vars
  27.    success : boolean;
  28.    type : integer;
  29.    
  30. begin
  31.    while (number > 0) do
  32.       begin
  33.          type := Random(7) + 1;
  34.          success := Add_unit_to_drop_ship(type);
  35.          if success then
  36.             number := number - 1;
  37.       end;
  38. end;
  39.  
  40. begin
  41.    // first determine the total number of troops on board the fleet
  42.    send := Random(max_send_down()) + 1;
  43.    deploy_random_squad(send);
  44.    target := Random(127);
  45.    success := Deploy_drop_ship(target);
  46. end;
  47.  
  48.  
  49.  
  50.  
  51.  
  52.